package com.example.g5project.repository.dao;

import com.example.g5project.entity.frontEndObject.FigureData;
import com.example.g5project.entity.frontEndObject.NewChat;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;


/**
 * @author Hu Zirui
 * @version 1.0.0
 * @ClassName ConsultantIDwithMonthGrade.java
 * @Description TODO
 * @createTime 2022年04月03日 22:00:00
 */
@Repository
@Transactional
@SuppressWarnings("all")
public interface FigureDataDao extends JpaRepository<NewChat, Integer>, JpaSpecificationExecutor {
    @Query(value = "select DAY(chat.start_time) as date, count(*) as number from chat where MONTH(chat.start_time) = ?1 group by DAY(chat.start_time) order by DAY(chat.start_time) limit ?2", nativeQuery = true)
    ArrayList<FigureData> getAllConsultNumberLimitK(String month, Integer k);
}
